package cn.alise.qdp.service.inventory;

import java.util.List;
import java.util.Map;
import javax.annotation.Resource;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.CollectionUtils;
import cn.alise.qdp.model.inventory.Inventory;
import cn.alise.qdp.mapper.inventory.InventoryMapper;

/**
 * InventoryService
 * Mon Nov 06 10:20:13 GMT+08:00 2023  CHENH
 */ 
@Service
@Transactional(rollbackFor = Exception.class)
public class InventoryService {

	@Resource(name = "inventoryMapper")
	private InventoryMapper inventoryMapper;

	/**
	 * 获取指定一条数据
	 */ 
	public Inventory get(Inventory args) {
		List<Inventory> list = this.list(args);
		if (!CollectionUtils.isEmpty(list)) {
			return list.get(0);
		}

		return null;
	}

	/**
	 * 获取列表
	 */ 
	public List<Inventory> list(Inventory args) {
		return this.inventoryMapper.list(args);
	}

	/**
	 * 分页列表
	 */ 
	public List<Inventory> page(Map<String, Object> args) {
		return this.inventoryMapper.page(args);
	}

	/**
	 * 列表总数
	 */ 
	public int total(Inventory args) {
		return this.inventoryMapper.total(args);
	}

	/**
	 * 删除数据
	 */ 
	public int delete(Inventory args) {
		return this.inventoryMapper.delete(args);
	}

	/**
	 * 更新数据
	 */ 
	public int save(Inventory args) {
		return this.inventoryMapper.insert(args);
	}

	/**
	 * 新增数据
	 */ 
	public int update(Inventory args) {
		return this.inventoryMapper.update(args);
	}

}

